package smoker.tools;

import java.awt.*;
import javax.swing.*;

public class ComboBoxRenderer extends JLabel implements ListCellRenderer {
	public static final long serialVersionUID = 0;
	public ComboBoxRenderer() {
		setOpaque(true);
		setHorizontalAlignment(CENTER);
		setVerticalAlignment(CENTER);
	}

	public Component getListCellRendererComponent(JList list, Object value,
			int index, boolean isSelected, boolean cellHasFocus) {
		if (isSelected) {
			setBackground(list.getSelectionBackground());
			setForeground(list.getSelectionForeground());
		} else {
			setBackground(list.getBackground());
			setForeground(list.getForeground());
		}
		setIcon((ImageIcon) value);
		setPreferredSize(new Dimension(34, 42));
		return this;
	}
}